/*
 * Create Author  : jinpeng.chen
 * Create Date    : 2018-10-17
 * Project        : designpattern-learn
 * File Name      : HtmlInvoker.java
 *
 * Copyright (c) 2010-2018 by 18Birdies, LLC.
 * All Rights Reserved.
 *
 */
package com.charles.designpattern.responsibilitychain;

import org.springframework.stereotype.Component;

/**
 * 功能描述:  <p>
 *
 * @author : jinpeng.chen <p>
 * @version 1.0 2018-10-17
 * @since designpattern-learn 1.0
 */
@Component
public class HtmlFilter implements Filter<BizRequest, BizResponse> {

  @Override
  public void doFilter(final BizRequest bizRequest, final BizResponse bizResponse, final FilterChain<BizRequest, BizResponse> chain) {
    try {
      String requestStr = bizRequest.getRequestStr();
      bizRequest.setRequestStr(requestStr.replace('<', '[').replace('>', ']'));
      chain.doFilter(bizRequest, bizResponse, chain);
    } catch (Exception e) {
    }
  }
}
